package cn.iocoder.yudao.module.hs.dal.mysql.trayscanrecord;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.hs.controller.admin.trayscanrecord.vo.TrayScanRecordPageReqVO;
import cn.iocoder.yudao.module.hs.controller.admin.trayscanrecord.vo.TrayScanRecordRespVO;
import cn.iocoder.yudao.module.hs.dal.dataobject.trayscanrecord.TrayScanRecordDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 单号托盘点亮状态记录 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface TrayScanRecordMapper extends BaseMapperX<TrayScanRecordDO> {

    default PageResult<TrayScanRecordDO> selectPage(TrayScanRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TrayScanRecordDO>()
                .eqIfPresent(TrayScanRecordDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(TrayScanRecordDO::getOrderType, reqVO.getOrderType())
                .eqIfPresent(TrayScanRecordDO::getTrayCode, reqVO.getTrayCode())
                .eqIfPresent(TrayScanRecordDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(TrayScanRecordDO::getLightTime, reqVO.getLightTime())
                .betweenIfPresent(TrayScanRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TrayScanRecordDO::getId));
    }

    List<TrayScanRecordRespVO> getEntryOrderTrayList(@Param("orderId") Long orderId);

    List<TrayScanRecordRespVO> getReceiveOrderTrayList(@Param("orderId") Long orderId);
}